<?php




/**
* Browses all images within an image
*/

# When a user will cancel add/edit forms, we will try to come back here
url::remember();

$album_id = $variable->get('id', 'integer', $variable->session('search_album_id', 'integer', 0));
$_SESSION['search_album_id']=$album_id;

# Begin the paginator along with: images
# Parameter: GET[], and per page
$pagination = new pagination('pg', IMAGE_PER_ALBUM_PER_PAGE);

$images = new images();

$search_images = $variable->remember_string('search_images');
$smarty->assign('search_images', $search_images);

$condition = new condition();

$condition->add('FULL', array(
	"e.subdomain_id={$subdomain_id}", # Bind the records
	"e.is_active='Y'", # Do not remove this
	#"e.is_approved='Y'", # Optionally use this flag
	
	"a.album_id={$album_id}", # chosen album ID
));

# Compulsory conditions
$condition->add('AND', array(
	#'e.search_field' => 'Y', # Partial %contents%
));

# List out the entries
$entries = $images->list_album_images(
	$condition,
	$from_index=$pagination->begining_entry(),
	$pagination->per_page()
);

# Pagination helper
$pagination->set_total($images->total_entries());
$smarty->assignByRef('pagination', $pagination);

# Assign to Smarty: Lists
$smarty->assignByRef('imagess', $entries);
?>